This page last changed on Feb 27, 2009 by stepheneb.

If you start an authoring jnlp from an online page for an activity that is fetched from an online location and edit the activity content and save the otml locally some (all?) of the relative references to resources will be rewritten to be absolute references.

Here's an example:

Start at this page: http://continuum.concord.org/otrunk/examples/LOOPS/ot-index.html

Under the column of links titled otml file is this link for the otml for spring2009_activity3: spring2009_activity3.otml.

Currently if you download this file and list the lines that have the string ''http://' you'll see 5 lines listed

$ grep -n 'http:\/\/' spring2009_activity3.otml
108:   <OTInclude href="http://continuum.concord.org/otrunk/examples/LOOPS/global-imports/loops-view-bundle.otml" />
131:   <OTJavascript src="http://continuum.concord.org/otrunk/examples/LOOPS/scripts/student_script.js" />
2674:  <OTJavascript local_id="change_page.js" src="http://continuum.concord.org/otrunk/examples/LOOPS/scripts/change_page.js" />
2675:  <OTJavascript local_id="show_message.js" src="http://continuum.concord.org/otrunk/examples/LOOPS/scripts/show_message.js" />
2676:  <OTJavascript local_id="loops_authoring_script.js" src="http://continuum.concord.org/otrunk/examples/LOOPS/scripts/loops_authoring_script.js" />

Here are the href attributes urls as a list:

href="http://continuum.concord.org/otrunk/examples/LOOPS/global-imports/loops-view-bundle.otml"
href="http://continuum.concord.org/otrunk/examples/LOOPS/scripts/student_script.js"
href="http://continuum.concord.org/otrunk/examples/LOOPS/scripts/change_page.js"
href="http://continuum.concord.org/otrunk/examples/LOOPS/scripts/show_message.js"
href="http://continuum.concord.org/otrunk/examples/LOOPS/scripts/loops_authoring_script.js"

If you run 'spring2009_activity3' from the learner jnlp link it will load the activity otml file from:

Java will set the codebase to the base url for this file:

If you were to copy just this otml file to your local computer and run it locally in it's current state:

it would also work because it has absolute url references to the Javascript resources and will load them from the web server.

If I changed the href attributes to relative references like this:

href="global-imports/loops-view-bundle.otml"
href="scripts/student_script.js"
href="scripts/change_page.js"
href="scripts/show_message.js"
href="scripts/loops_authoring_script.js"

And check this change into subversion then when you run 'spring2009_activity3' from the server Java will recognize these are relative references, add the default codebase and load the resources from the web server.

For example when the Java application sees this href attribute:

  • href="scripts/student_script.js"

It will prefix the resource reference with http://continuum.concord.org/otrunk/examples/LOOPS/ to produce:

  • href="http://continuum.concord.org/otrunk/examples/LOOPS/scripts/student_script.js"

However if you download just the otml file and run it locally the resources will not be found.

However if I change the resource references to relative and you download the LOOPS/ directory from subversion:

svn checkout http://svn.concord.org/svn/projects/trunk/common/java/otrunk/otrunk-examples/LOOPS

and you now run the activity LOOPS/spring2009_activity3.otml from your local filesystem the resources will be located using relative references and the activity will work.

If however you author the local activity by first running the author jnlp link for spring2009_activity3 from this page:

Then use the File::Open command to load your local otml file, make changes, and save them the resource references will be re-written as absolute.

You need to run the start the jnlp locally in authoring mode and then when you author a local otml file with relative references these won't be re-written as absolute references.

If you download the otml file and run it locally the resources should now be found by the authoring view. This was only a problem with images embedded in documents.

Posted by scytacki at Jun 17, 2009 14:53
Document generated by Confluence on Jan 27, 2014 16:52